(function(){
	var publicback='<div id="public_back">'
//						+'<div id="back_web"><a @click="back_web()"><img src="../../images/back_web.png" /></a></div>'
//						+'<div id="jzzs_back"><a href="../jingzhunzhaoshang/company_evaluate.html"><img src="../../images/jzzs_back.png" /></a></div>'
						+'<div id="backTop" @click="backTop" v-show="backshow" title="返回顶部"><img src="../images/backtop.png" /></div>'
					+'</div>'
	var publicBack=Vue.extend({
		template:publicback,
//		props:{
//			feedback:Boolean,
//			require:true
//		},
		data:function(){
			return {
				backshow:false,
				scrollTop:""
			}
		},
		watch:{
			scrollTop(val){
				if(this.scrollTop > 300){
					this.backshow=true;
				}else{
					this.backshow=false;
				}
			}
		},
		methods:{
			handleScroll:function(){
				this.scrollTop=document.getElementsByClassName('container')[0].scrollTop;
				if(this.scrollTop > 0){
					this.backshow=true;
				}
			},
//			back_web:function(){
//				alert(1);
//				window.history.go(-1);
//			},
			backTop:function(){
				let timer = null,
					_that=this;
					cancelAnimationFrame(timer);
					timer = requestAnimationFrame(function fn(){
						if(_that.scrollTop > 0){
							_that.scrollTop -=10;
							document.getElementsByClassName('container')[0].scrollTop=_that.scrollTop;
							timer = requestAnimationFrame(fn);
						}else{
							cancelAnimationFrame(timer);
							this.backshow=false;
						}
					})
			}
		},
		mounted:function(){
			document.getElementsByClassName('container')[0].addEventListener("scroll",this.handleScroll);
		},
		destroyed:function(){
			document.getElementsByClassName('container')[0].addEventListener("scroll",this.handleScroll);
		}
	})
	window.backMain=publicBack
	console.log(window.backMain);
})()

